const CombatSkillDataStructMapping = {
  headerOp: {name: '操作', type: 'number', def: 0, width: 80},
  id: {name: '技能id', type: 'number', def: 0, width: 80},
  name: {name: '名字', type: 'string', def: '', width: 100},
  min_lev: {name: '等级下限', type: 'number', def: 0, width: 80},
  max_lev: {name: '等级上限', type: 'number', def: 0, width: 80},
  type: {name: '类型', type: 'string', def: '', width: 80},
  attack_type: {name: '攻击类型', type: 'string', def: '', width: 80},
  elem_type: {name: '伤害属性', type: 'string', def: '', width: 80},
  target_type: {name: '技能目标', type: 'string', def: '', width: 80},
  active_type: {name: '主动技能类型', type: 'string', def: '', width: 80},
  special_type: {name: '特殊类型列表', type: 'string', def: '', width: 80},
  speed: {name: '出手顺序', type: 'string', def: '', width: 80},
  pre_cooldown: {name: '前置冷却时间', type: 'string', def: '', width: 80},
  cooldown: {name: '冷却时间', type: 'string', def: '', width: 80},
  mp_template: {name: '法力模板', type: 'string', def: '', width: 80},
  cost_point: {name: '消耗能量', type: 'number', def: 0, width: 80},
  cost_anger: {name: '消耗怒气', type: 'number', def: 0, width: 80},
  self_cond: {name: '发动检测', type: 'string', def: '', width: 80},
  self_loss: {name: '发动消耗', type: 'string', def: '', width: 80},
  buff_self: {name: '自身BUFF', type: 'string', def: '', width: 80},
  buff_target: {name: '目标BUFF', type: 'string', def: '', width: 80},
  before_scripts: {name: '前置脚本', type: 'string', def: '', width: 80},
  after_scripts: {name: '后置脚本', type: 'string', def: '', width: 80},
  dmg_id: {name: '伤害id', type: 'number', def: 0, width: 80},
  pass_check_script: {name: '发动检测', type: 'string', def: '', width: 80},
  pass_script: {name: '被动脚本', type: 'string', def: '', width: 80},
  show_passive: {name: '被动触发飘字类型', type: 'string', def: '', width: 80},
  is_shout: {name: '是否喊招', type: 'string', def: '', width: 80},
  extra_data: {name: '额外参数', type: 'string', def: '', width: 80},
}

const DmgDataStructMapping = {
  headerOp: {name: '操作', type: 'number', def: 0, width: 80},
  dmg_id: {name: '伤害id', type: 'number', def: 0, width: 80},
  desc: {name: '描述', type: 'string', def: '', width: 80},
  min_lev: {name: '等级下限', type: 'number', def: 0, width: 80},
  max_lev: {name: '等级上限', type: 'number', def: 0, width: 80},
  attack_times: {name: '攻击次数', type: 'number', def: 0, width: 80},
  skill_eff_type: {name: '技能效果类型', type: 'number', def: 0, width: 80},
  self_mode: {name: '自身模式', type: 'number', def: 0, width: 80},
  target_mode: {name: '目标模式', type: 'number', def: 0, width: 80},
  target_list: {name: '目标列表', type: 'string', def: '', width: 80},
  dmg_ratio: {name: '伤害比例', type: 'string', def: '', width: 80},
  dmg_addt: {name: '伤害加成', type: 'string', def: '', width: 80},
  dmg_scripts: {name: '伤害脚本', type: 'string', def: '', width: 80}
}

const BuffDataStructMapping = {
  headerOp: {name: '操作', type: 'number', def: 0, width: 80},
  name: {name: '名字', type: 'string', def: 'undefined', width: 80},
  buff_id: {name: 'BUFFid', type: 'number', def: 0, width: 80},
  type: {name: '类型', type: 'number', def: 0, width: 80},
  same_mode: {name: '是否可叠加', type: 'number', def: 0, width: 80},
  class: {name: '类', type: 'number', def: 0, width: 80},
  lev: {name: '级', type: 'number', def: 0, width: 80},
  max_class: {name: '限制类', type: 'string', def: '[]', width: 80},
  time_type: {name: '定时类型', type: 'number', def: 0, width: 80},
  eff_type: {name: '效果类型', type: 'number', def: 0, width: 80},
  eff_sec_type: {name: '效果子类型', type: 'number', def: 0, width: 80},
  eff_thi_type: {name: '效果特殊类型', type: 'number', def: 0, width: 80},
  init_layer: {name: '初始层数', type: 'number', def: 0, width: 80},
  max_layer: {name: '最大层数', type: 'number', def: 0, width: 80},
  can_dispel: {name: '能否驱散', type: 'number', def: 0, width: 80},
  duration: {name: '持续回合', type: 'number', def: 0, width: 80},
  hit_ratio: {name: '命中率', type: 'number', def: 0, width: 80},
  min_hit_ratio: {name: '命中下限', type: 'number', def: 0, width: 80},
  max_hit_ratio: {name: '命中上限', type: 'number', def: 0, width: 80},
  hit_script: {name: '命中脚本', type: 'string', def: '[]', width: 80},
  script_list: {name: 'buff脚本', type: 'string', def: '[]', width: 80},
  revise_duration: {name: '速差修正回合', type: 'number', def: 0, width: 80},
  eff_notice: {name: '战斗状态提示', type: 'number', def: 0, width: 80},
}


const CombatSkillTableConfig = {
  name: 'skill_combat_data',
  showHeaderTexts: Object.values(CombatSkillDataStructMapping).map(item => item.name),
  dataSchema: () => {
    const schema: Record<string, any> = {}
    Object.keys(CombatSkillDataStructMapping).forEach(key => {
      schema[key] = null
    })
    return schema
  },
  colDataMapping: Object.keys(CombatSkillDataStructMapping).map(key => (
    {
      data: key,
      width: CombatSkillDataStructMapping[key as keyof typeof CombatSkillDataStructMapping].width,
    }
  ))
}

const DmgTableConfig = {
  name: 'dmg_data',
  showHeaderTexts: Object.values(DmgDataStructMapping).map(item => item.name),
  dataSchema: () => {
    const schema: Record<string, any> = {}
    Object.keys(DmgDataStructMapping).forEach(key => {
      schema[key] = null
    })
    return schema
  },
  colDataMapping: Object.keys(DmgDataStructMapping).map(key => (
    {
      data: key,
      width: DmgDataStructMapping[key as keyof typeof DmgDataStructMapping].width,
    }
  ))
}

const BuffTableConfig = {
  name: 'buff_data',
  showHeaderTexts: Object.values(BuffDataStructMapping).map(item => item.name),
  dataSchema: () => {
    const schema: Record<string, any> = {}
    Object.keys(BuffDataStructMapping).forEach(key => {
      schema[key] = null
    })
    return schema
  },
  colDataMapping: Object.keys(BuffDataStructMapping).map(key => (
    {
      data: key,
      width: BuffDataStructMapping[key as keyof typeof BuffDataStructMapping].width,
    }
  ))
}


export { CombatSkillTableConfig, DmgTableConfig, BuffTableConfig }
